#include <iostream>
#include <pthread.h>

using namespace std;

int num = 0;

void* add(void* args)
{
    for(int i = 0; i < 10000; ++i)
    {
        ++num;
    }
}

int main()
{
    pthread_t tid;
    pthread_create(&tid, nullptr, add, (void*)"test add func");
    
    for(int i = 0; i < 10000; ++i)
    {
        ++num;
    }
    pthread_join(tid, nullptr);
    cout << "num的值为: " << num << endl;
    return 0;
}